
 <%@ page import="net.tanesha.recaptcha.ReCaptcha" %>
 <%@ page import="net.tanesha.recaptcha.ReCaptchaFactory" %>
 
 <%
  if(session.isNew())
  {
      session.setAttribute("login", false);
      session.setAttribute("count",0); 
  }
  boolean login = (Boolean)session.getAttribute("login");
  if(login)
  {
      int userType = (Integer)session.getAttribute("userType");
      switch(userType)
      {
          case 0:
            response.sendRedirect("user_home.jsp");
          break;
          case 1:
            response.sendRedirect("admin_page.jsp");
          break;
          case 2:
            response.sendRedirect("manager_page.jsp");
          break;
          
      }
  }
  
%>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="CSS/generic_home.css" rel="stylesheet" type="text/css" />
<link href="CSS/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src = "js/jquery-latest.js"></script>
<script type="text/javascript" src = "js/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src = "js/jquery.validationEngine.js"></script>
<script>
     $(document).ready(function(){

			// binds form submission and fields to the validation engine

			$("#login_form").validationEngine('attach');

		});
    </script>


<style type="text/css">
.auto-style1 {
	color: #969696;
}
.auto-style2 {
	font-size: 37pt;
}
</style>


</head>

<body>
<div id="header_container" style="height: 73px">

		<div id ="form_container" style="height: 539px; left: 8px; top: 13px;">
			<div style="height: 59px">
				FOOBAR<div id="foobar_title" style="position: absolute; width: 153px; height: 62px; z-index: 1; right: -6px; top: 13px;" class="auto-style2">
					<a href="generic_home.jsp" style="text-decoration:none; color: #628797;">HOME</a></div>
			</div>
			
			<div style=" color: #FFFFFF; height: 78px; background-color: #628797; width: 863px; text-indent: -3px; line-height: 13mm;" class="auto-style1">
				BOOKSHOP
				
			<div id="register_text"  style="position: absolute; width: 228px; height: 50px; z-index: 2; right: -78px; top: 52px; font-size: 30pt;">
				<a href="register.jsp" style="text-decoration:none; color: #FFFFFF;">REGISTER</a></div>
				
			<div id="search_area" style="font-size: 12pt; position: absolute; width: 548px; height: 42px; z-index: 3; left: 409px; top: 99px; right: -94px;">
							 <form method="post" action=""> 	
					search   <input name="search_input" type="text" /> 
					category <select name="category" style="width: 140px; height: 22px;">
							 <option></option>
							 </select>
							 <input type="image" src="Images/arrow.png" height="28" style="bottom: 0px" width="31" />
							 </form></div>
			</div>
					
			<div id ="choices" style=" height: 54px;">
					<a href="#" id="choices"><span class="books">LOGIN</span></a></div>
			<div style="height: 290px; background-color: #628797;">
				<div style=" text-align:center;  font-size: 10pt; height: 577px; background-color: #628797; color: #FFFFFF;">
			
				<form id="login_form" method="post" action="ServletLogIn" style="height: 504px">
	                        
                                    <fieldset name="Group1" style="">
				<legend>User Details</legend>

				Username<input id="box" class="validate[required,minSize[7], custom[onlyLetterNumber]]" name="username" type="text" /><br />
				Password<input id="password" class="validate[required],minSize[10]] "  name="password" type="password" /><br />
                                "v
                               <%                                             
                                    if((Integer)session.getAttribute("count") == 3)
                                    {
                                        ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LfdCc4SAAAAAKJ72RfYk_9C4NoTV_lXAncW7Xdj", "6LfdCc4SAAAAAI4p64kJ91fJl4NHEFMULd1ZP4QS", false);
                                        out.print(c.createRecaptchaHtml(null, null));
                                    }                                                                                        
                                %>

		</fieldset><br />
                
                                <input name="submit"  type="Submit" value="Submit" />
				</form>
				
										
			</div>
			
		</div>
</div>
	
	


</body>

</html>
